package stru1.day12;

/**
 * 226. 翻转二叉树
 */
public class Solution1 {
    public static void main(String[] args) {
        System.out.println(invertTree(null));
    }

    /**
     * 递归
     */
    public static TreeNode invertTree(TreeNode root) {
        if (root == null) return null;

        TreeNode left = root.left;
        root.left = invertTree(root.right);
        root.right = invertTree(left);
        return root;
    }
}
